package com.juc.function;

import java.util.function.Supplier;

/**
 * Supplier 供给型接口 没有参数，只有返回值
 */
public class Demo4 {
    public static void main(String[] args) {
        // 简化前
        Supplier supplier1 = new Supplier<Integer>() {
            @Override
            public Integer get() {
                System.out.println("get()");
                return 1024;
            }
        };
        // 简化后
        Supplier supplier2 = () -> 1024;
        System.out.println(supplier1.get());
        System.out.println(supplier2.get());
    }
}
